<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>我的</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/aui.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/yzl.css"/>
    <style>

    *{
    margin: 0;
    padding: 0;
}
html,body{
    width: 100%;
    height: 100%;
}
#app{
    width:100%;
    /*height: 100%;*/
    background: url(../../image/3_bg.png) center center no-repeat;
    background-size: cover;
    background-repeat:no-repeat;
    -moz-background-size: 100% 100%;
    padding-bottom: 30px;
}
.aui-bar-btn-item{
  border-color: #ffffff;
  background: #f7f4f2
}

    </style>
</head>
<body style="height:100%">
<div id="app" class="container"  v-cloak style="height:100%">
  <div class="pasture-main" >
    <div class="pasture-top" >
      <div class="pasture-assets"  style="width:100%;font-size:0px;">
        <div class="my-level" v-open-win vurl="../user/mycoupon">
          <img v-src="'../../image/3_quan.png'">
          <span style="color:#FF504D">{{nFormatter(user.voucher,2)}}</span>
        </div>
        <div class="my-coins"   v-myclick="opencoins">
          <img v-src="'../../image/3_jinbi.png'">
          <span style="color:#FFAF53">{{nFormatter(user.gold,2)}}</span>

        </div>
        <div class="my-prestige"  v-myclick="prestige">
          <img v-src="'../../image/3_shengwang.png'">
          <span style="color:#3ACCC7">{{nFormatter(user.renown,2)}}</span>

        </div>
        <div class="my-question" style="width:10%" v-myclick="help">
          <img v-src="'../../image/3_bangzu.png'" style="width:100%;margin-right:0px">
        </div>

      </div>
      <div class="pasture-user" v-open-win vurl="../user/level" style="position:absolute;top:6%;z-index:1">
        <div class="user-avatar" ><img :src="user.portrait"></div>
        <div class="user-level" >
          <div class="level-name" >等级：{{user.name}}</div>
          <div class="level-pic">
            <img :src="user.level_id>0?'../../image/big/level1.png':'../../image/big/level0.png'">
            <img v-show="user.is_gold_level2=='0'" :src="user.level_id>1?'../../image/big/level2.png':'../../image/big/level0.png'">
            <img v-show="user.is_gold_level2=='1'" :src="user.level_id>1?'../../image/big/level2_1.png':'../../image/big/level0.png'">
            <img v-show="user.is_gold_level3=='0'" :src="user.level_id>2?'../../image/big/level3.png':'../../image/big/level0.png'">
            <img v-show="user.is_gold_level3=='1'" :src="user.level_id>2?'../../image/big/level3_1.png':'../../image/big/level0.png'">
            <img :src="user.level_id>3?'../../image/big/level4.png':'../../image/big/level0.png'">
            <img :src="user.level_id>4?'../../image/big/level5.png':'../../image/big/level0.png'">
            <img :src="user.level_id>5?'../../image/big/level6.png':'../../image/big/level0.png'">
          </div>
        </div>
        <div style="clear:both"></div>
      </div>
    </div>
    <div class="product_milk" style="position:absolute;top:8%;right:16%;padding:5px;z-index:1">
      <img v-src="'../../image/3_yuanchannai.png'" width="56px">

    </div>
    <div v-open-win vurl="product_milk" style="position: absolute;top: 13.5%;z-index:1;right:15%;width:75px;text-align:center;font-size:12px;color:#172E71;">{{user.product_milk}}</div>

    <div class="pasture-run"  style="position:absolute;top:7%;">
      <img src="../../image/yun_gif.gif" width="100%" >
    </div>
    <!-- <div  style="position: absolute;bottom: 40%;left:16px;"><img v-open-win vurl="product_milk" width="75px" v-src="'../../image/pd_milk.png'" ></div> -->
    <!-- <div v-open-win vurl="product_milk" style="position: absolute;bottom: 44%;left:16px;width:75px;text-align:center;font-size:13px;color:#172E71;">{{user.product_milk}}</div> -->

    <div class="pasture-foot">
      <div class="foot-left" v-myclick="[1, opendshop]">
        <img v-src="'../../image/3_6sc.png'">
        <div class="shicao">
          <div class="shicao_pre" :style="getpre(user.milk,10)"></div>
        </div>
        <div class="shicao_key">{{user.milk}}/10</div>
      </div>
      <div class="foot-right" >
        <div v-myclick="shengji">
          <img v-src="'../../image/3_sj_1.png'" v-show="user.grow_calfs>0&&user.milk>=10">
          <img v-src="'../../image/3_sj_2.png'" v-show="user.grow_calfs<=0||user.milk<10">
        </div>
        <div style="margin-top:5px" v-show="user.grow_calfs>0&&user.milk>=10">您有{{user.grow_calfs}}头小牛可以升级为奶牛</div>
        <div style="margin-top:5px" v-show="user.grow_calfs<=0">您没有可升级的小牛</div>
        <div style="margin-top:5px" v-show="user.grow_calfs>0&&user.milk<10">您的营养奶不足</div>

      </div>
    </div>
    <div class="pasture-middle">
      <div class="pasture-pets" v-myclick="[0, showmodal]">
        <div class="pets-property">小牛&nbsp;&nbsp;{{user.calf}}头</div>
        <div class="pets-pic"><img v-src="'../../image/3_xiaoniu.png'"></div>
        <div class="pets-count">领养 ></div>

      </div>
      <div class="pasture-pets" v-myclick="[9, showmodal]">
        <div class="pets-property">奶牛&nbsp;&nbsp;{{user.cow}}头</div>
        <div class="pets-pic"><img v-src="'../../image/3_daniu.png'"></div>
        <div class="pets-count" id="time_product"></div>

      </div>
      <div class="pasture-pets" v-myclick="[2, showmodal]">
        <div class="pets-property">天堂牛&nbsp;&nbsp;{{user.godcow}}头</div>
        <div class="pets-pic"><img v-src="'../../image/3_tiantangniu.png'"></div>
        <div class="pets-count" >献祭 ></div>

      </div>
    </div>
    <div class="aui-mask aui-mask-in" v-show="modal" style="z-index:2"></div>

    <div class="alert_modal" v-show="modal">
      <div class="cangku modal-container" v-show="showtype==1">
        <div class="my-store" style="background-color:#E3FFEF">
          <img v-src="'../../image/3_milk.png'" style="width:40px;margin:0 auto">
          <span style="text-align:center">原产奶</span>
        </div>
        <div class="modallogo"><img  v-src="'../../image/title_changku.png'"></div>
        <img class="modalclose" v-src="'../../image/3_guanbi.png'" v-myclick="[1, showmodal]">
        <div class="sum">{{user.product_milk}}桶</div>
        <div v-open-win vurl="product_milk" style="color:#172E71;text-align:center;position:absolute;bottom:80px;width:100%">查看明细 ></div>
        <div class="modalbutton" v-myclick="[2, opendshop]">
          <img v-src="'../../image/anniu_3.png'" >
          <span>出售</span>
        </div>
      </div>
      <div class="jishi modal-container" v-show="showtype==0">
        <img class="modalclose" v-src="'../../image/3_guanbi.png'" v-myclick="[0, showmodal]">

        <div class="my-store">
          <img v-src="'../../image/3_xiaoniu.png'" width="40px">
          <span>小牛</span>
          <!-- <div style="text-align:center">小牛</div> -->
        </div>
        <div class="modallogo"><img  v-src="'../../image/title_jishi.png'"></div>
        <div class="sum" style="top:110px">
          <img v-src="'../../image/3_jinbi2.png'" />
          <span>6元/头</span>
        </div>

        <div class="up_desc" v-show="next_level_cow>0||renown_cow>0||keep_level_cow>0">
          <p v-show="next_level_cow>0&&user.level_id!=6">升到{{next_level_name}}还需要领养{{next_level_cow}}头小牛</p>
          <p v-show="parseInt(renown_cow)>0">根据你的声望，推荐领养{{parseInt(renown_cow)}}头小牛</p>
          <p v-show="keep_level_cow>0">保持当前等级还需要领养{{keep_level_cow}}头小牛</p>
        </div>
          <div class="aui-bar aui-bar-btn modal_check" type="count" id="demo" style="width:50%">
            <div class="aui-bar-btn-item aui-font-size-20" v-myclick="[0, changecount]" style="width:60px;border:1px solid #165786">
                <i class="aui-iconfont aui-icon-minus" style="font-weight:800"></i>
            </div>
            <div class="aui-bar-btn-item" style="width:120px;border:1px solid #165786;">
                <input type ="number"  pattern="[0-9]*" min="1" max="1000" class="aui-input aui-text-center" v-model="count" width="120px" >
            </div>
            <div class="aui-bar-btn-item aui-font-size-20 " v-myclick="[1, changecount]" style="width:60px;border:1px solid #165786">
                  <i class="aui-iconfont aui-icon-plus" style="font-weight:800"></i>
              </div>
          </div>
          <div class="total_price">共{{total_coins}}金币</div>
          <!-- <div  class="total_price" v-show="show_buy" v-myclick="buycoins" style="top:245px;color:#0099FF">金币不足，去购买 ></div> -->
        <div class="dikou" v-show="user.gold>0" v-myclick="change_selected">
          <!-- <span ></span> -->
          <img v-src="'../../image/selected.png'" width="18px" v-show="is_selected">
          <img v-src="'../../image/unselected.png'" width="18px" v-show="!is_selected">

          <span v-show="(parseInt(user.gold)/10)<count*6">使用{{user.gold}}金币抵扣{{(parseInt(user.gold)/10).toFixed(2)}}元</span>
          <span v-show="(parseInt(user.gold)/10)>=count*6">使用{{count*60}}金币抵扣{{(count*6).toFixed(2)}}元</span>

        </div>
        <div class="modalbutton"  v-myclick="buyProp" style="bottom:10px">
          <img v-src="'../../image/anniu_3.png'" >
          <span v-show="(parseInt(user.gold)/10)<count*6">需要{{is_selected?(count*6-parseInt(user.gold)/10).toFixed(2):count*6}}元购买</span>
          <span v-show="(parseInt(user.gold)/10)>=count*6">{{is_selected?count*60+'金币购买':'需要'+(count*6).toFixed(2)+'元购买'}}</span>
        </div>
        <!-- <div class="modalbutton" v-show="show_buy" v-myclick="buycoins" style="bottom:10px">
          <img v-src="'../../image/button_jinbi.png'" >
          <span>金币不足，去购买</span>
        </div> -->
      </div>
      <div class="cangku modal-container" v-show="showtype==2">
        <div class="my-store" style="background-color:#FBDFDD">
          <img v-src="'../../image/3_tiantangniu.png'" style="width:40px;margin:0 auto">
          <span style="text-align:center">天堂牛</span>
        </div>
        <div class="modallogo"><img v-src="'../../image/title_jitan.png'"></div>
        <img class="modalclose" v-src="'../../image/3_guanbi.png'" v-myclick="[2, showmodal]">

        <div class="sum">{{user.godcow}}头</div>
        <div class="cow_wake" >牛群每生产24桶原产奶就会有1头奶牛转换为天堂牛</div>
        <div class="total_price">每头天堂牛献祭可获得6金币，您已献祭{{user.count_sacrifice}}头天堂牛，累计获得{{user.change_gold}}金币</div>

        <div class="modalbutton" v-myclick="sacrifice">
          <img v-src="'../../image/anniu_3.png'" v-show="user.godcow>0">
          <img v-src="'../../image/anniu_1.png'" v-show="user.godcow<=0">
          <span>全部献祭</span>
        </div>
      </div>
      <div class="qiandao modal-container" v-show="showtype==3">
        <div class="modallogo"><img v-src="'../../image/title_huodong4.png'"></div>
        <img class="modalclose" v-src="'../../image/3_guanbi.png'" v-myclick="[3, showmodal]">
        <div class="my-qiandao">
          <div class="qiandao_crad" >
            <img    v-src="'../../image/bg_qiandao3.png'" style="z-index:66" v-show="signarr.indexOf('1')>-1">
            <img    v-src="'../../image/bg_qiandao1.png'" v-show="signarr.indexOf('1')==-1">
            <div class="card-top">第1天</div>
            <div class="card-coins">1金币</div>
          </div>
          <div class="qiandao_crad">
            <img    v-src="'../../image/bg_qiandao3.png'" style="z-index:66" v-show="signarr.indexOf('2')>-1">
            <img    v-src="'../../image/bg_qiandao1.png'" v-show="signarr.indexOf('2')==-1">
            <div class="card-top">第2天</div>
            <div class="card-coins">1金币</div>
          </div>
          <div class="qiandao_crad qianactive">
            <img    v-src="'../../image/bg_qiandao3.png'" style="z-index:66" v-show="signarr.indexOf('3')>-1">
            <img    v-src="'../../image/bg_qiandao2.png'" v-show="signarr.indexOf('3')==-1">
            <div class="card-top">第3天</div>
            <div class="card-coins">3金币</div>
          </div>
          <div class="qiandao_crad">
            <img    v-src="'../../image/bg_qiandao3.png'" style="z-index:66" v-show="signarr.indexOf('4')>-1">
            <img    v-src="'../../image/bg_qiandao1.png'" v-show="signarr.indexOf('4')==-1">
            <div class="card-top">第4天</div>
            <div class="card-coins">1金币</div>
          </div>
          <div class="qiandao_crad">
            <img    v-src="'../../image/bg_qiandao3.png'" style="z-index:66" v-show="signarr.indexOf('5')>-1">
            <img    v-src="'../../image/bg_qiandao1.png'" v-show="signarr.indexOf('5')==-1">
            <div class="card-top">第5天</div>
            <div class="card-coins">1金币</div>
          </div>
          <div class="qiandao_crad">
            <img    v-src="'../../image/bg_qiandao3.png'" style="z-index:66" v-show="signarr.indexOf('6')>-1">
            <img    v-src="'../../image/bg_qiandao1.png'" v-show="signarr.indexOf('6')==-1">
            <div class="card-top">第6天</div>
            <div class="card-coins">1金币</div>
          </div>
          <div class="qiandao_crad qianactive">
            <img    v-src="'../../image/bg_qiandao3.png'" style="z-index:66" v-show="signarr.indexOf('7')>-1">
            <img    v-src="'../../image/bg_qiandao2.png'" v-show="signarr.indexOf('7')==-1">
            <div class="card-top">第7天</div>
            <div class="card-coins">5金币</div>
          </div>
        </div>
        <div class="total_price" style="top:248px">连续签到的第3天和第7天可获得大量金币</div>
        <div class="modalbutton" style="bottom:8px" v-myclick="qiandao">
          <img v-src="'../../image/anniu_3.png'" v-show="signinfo.is_sign!=1">
          <img v-src="'../../image/anniu_1.png'"  v-show="signinfo.is_sign==1">
          <span>{{signinfo.is_sign==1?"已签到":'签到'}}</span>
        </div>
      </div>
      <div class="jiahua modal-container" v-show="showtype==4">
        <div class="modallogo"><img v-src="'../../image/title_huodong1.png'"></div>
        <img class="modalclose" v-src="'../../image/3_guanbi.png'" v-myclick="[4, showmodal]">

        <div style="margin-top:20px;"><img src="../../image/33jihua_1.png" style="width:90%;margin:0 auto;"></div>

        <div style="margin:0 auto;margin-top:10px;font-size:12px;" v-show="planinfo!=null&&planinfo.state==1">请在{{getDate(planinfo.date_add*1000,3)}}24:00之前完成该活动</div>
        <!-- <div class="modalbutton"   v-myclick="joinPlan">{{planinfo}}</div> -->
        <div class="modalbutton"  style="bottom:3%"  >
          <img style="width:60%;" v-show="planinfo.state==0||(planinfo.state==2&&planinfo.is_bonus==0)" v-src="'../../image/anniu_3.png'" >
          <img style="width:60%;" v-show="planinfo.is_bonus==1||planinfo.state==1||planinfo.state==3" v-src="'../../image/anniu_1.png'">
          <span v-show="planinfo.state==0" v-myclick="joinPlan">我要参与</span>
          <span v-show="planinfo.state==1">已参与</span>
          <span v-show="planinfo.state==2&&planinfo.is_bonus==0" v-myclick="getThreePlanBonus">领取奖励</span>
          <span v-show="planinfo.state==2&&planinfo.is_bonus==1">已领取</span>
          <span v-show="planinfo.state==3">未完成</span>

        </div>
      </div>
      <div class="dhzl modal-container" v-show="showtype==5">
        <div class="modallogo"><img v-src="'../../image/title_huodong3.png'"></div>
        <img class="modalclose" v-src="'../../image/3_guanbi.png'" v-myclick="[5, showmodal]">

        <div style="margin-top:15px;"><img :src="gold_muzhang" style="width:85%;margin:0 auto"></div>
        <div class="submembers" style="text-align:center;margin-top:2%">
          <img width="40px" style="margin:0 auto;display:inline-block;padding:3px" :src="item_one" v-for="(item_one, index) in type3_list">
        </div>
        <div class="modalbutton" style="bottom:2%"  v-myclick="['session',share_wx]">
          <img v-src="'../../image/anniu_3.png'" >
          <span>分享我的邀请链接</span>
        </div>
      </div>
      <div class="hjmin modal-container" v-show="showtype==6">
        <div class="modallogo"><img v-src="'../../image/title_huodong2.png'"></div>
        <img class="modalclose" v-src="'../../image/3_guanbi.png'" v-myclick="[6, showmodal]">

        <div style="margin-top:15px;position:relative">
          <img :src="gold_mumin" style="width:85%;margin:0 auto;">
          <div class="mumin">
            <div class="mumin_pre" :style="getpre(GoldLevel2Count,4999)"></div>
          </div>
          <div class="mumin_key">{{GoldLevel2Count}}/4999</div>
        </div>
        <div class="submembers" style="text-align:center;margin-top:2%">
          <img width="40px" style="margin:0 auto;display:inline-block;padding:3px" :src="item_one" v-for="(item_one, index) in type2_list">
        </div>
        <div class="modalbutton" style="bottom:2%" v-myclick="['session',share_wx]">
          <img v-src="'../../image/anniu_3.png'" >
          <span>分享我的邀请链接</span>
        </div>
      </div>
      <div class="shengji modal-container" v-show="showtype==7">
        <div class="modallogo"><img  v-src="'../../image/success_1.png'"></div>
        <img class="modalclose" v-src="'../../image/3_guanbi.png'" v-myclick="[7, showmodal]">
        <div class="desc" style="margin:20px">您已经成功将{{growUp_result.calf}}头小牛升级为奶牛了，获得{{parseInt(growUp_result.calf) * parseInt(user.product_milk_rate)}}桶原产奶</div>
        <div class="shengji_content" style="text-align:center">
          <img v-src="'../../image/3_milk.png'" style="margin:0 auto;">
          <div style="margin-top:20px">原产奶×{{parseInt(growUp_result.calf) * parseInt(user.product_milk_rate)}}</div>
        </div>
        <div class="modalbutton" v-myclick="[7, showmodal]">
          <img v-src="'../../image/anniu_3.png'" >
          <span>太棒了</span>
        </div>
      </div>
      <div class="gift modal-container" v-show="showtype==8">
        <div class="modallogo"><img  v-src="'../../image/first_gift.png'"></div>
        <div class="desc" style="margin-top:20px;font-size:13px">欢迎来到牧场，接受我们的见面礼吧~</div>
        <div class="gift_content" style="text-align:center;font-size:12px">
          <!-- <div style="display:inline-block;margin:10px">
            <img v-src="'../../image/3_xiaoniu.png'" style="margin:0 auto;width:50px">
            <div style="margin-top:10px">小牛×1</div>
          </div> -->
          <!-- <div style="display:inline-block;margin:10px">
            <img v-src="'../../image/3_milk.png'" style="margin:0 auto;width:50px">
            <div style="margin-top:10px">营养奶×10</div>
          </div> -->

        </div>
        <div class="gift_content" style="text-align:center;font-size:12px;margin-top:30px">
          <div style="display:inline-block;margin:10px">
            <img v-src="'../../image/3_xiaoniu.png'" style="margin:0 auto;width:50px">
            <div style="margin-top:10px">小牛×1</div>
          </div>
          <div style="display:inline-block;margin:10px">
            <img v-src="'../../image/3_quan1.png'" style="margin:0 auto;width:50px">
            <div style="margin-top:10px">券×100</div>
          </div>
          <div style="display:inline-block;margin:10px">
            <img v-src="'../../image/3_jinbi2.png'" style="margin:0 auto;width:50px">
            <div style="margin-top:10px">金币×5</div>
          </div>

        </div>
        <div class="modalbutton" v-myclick="get_gift" >
          <img v-src="'../../image/anniu_3.png'" >
          <span>太棒了</span>
        </div>
      </div>
      <div class="yuanchan modal-container" v-show="showtype==9">
        <div class="modallogo"><img  v-src="'../../image/product_num.png'"></div>
        <img class="modalclose" v-src="'../../image/3_guanbi.png'" v-myclick="[9, showmodal]">
        <div class="yuanchan_content" style="background-color:#e3ffef;width:80%;text-align:center;margin:0 auto;height:200px">
          <div style="text-align:left;margin:10px 10px 10px 20px;padding-top:10px;font-size:12px;">下次产奶倒计时</div>
          <div id="time_circle" style="line-height:40px;padding:20px;font-size:24px;font-weight:800;background-color:#fff;margin:10px 20px"></div>
          <div style="text-align:left;margin:10px 10px 10px 20px;font-size:12px;">每头奶牛总共能产24桶奶</div>

          <div style="text-align:left;margin:10px 10px 10px 20px;font-size:12px;">预计下次产奶：{{parseInt(user.milk_remain)>expected_product_milk?expected_product_milk:user.milk_remain}}桶</div>
          <div style="text-align:left;margin:10px 10px 10px 20px;font-size:12px;">当前奶牛总共还能产奶：{{user.milk_remain}}桶</div>

        </div>
        <div class="modalbutton" v-myclick="[9, showmodal]">
          <img v-src="'../../image/anniu_3.png'" >
          <span>太棒了</span>
        </div>
      </div>
      <div class="shengji modal-container" v-show="showtype==10">
        <div class="modallogo"><img  v-src="'../../image/level_up.png'"></div>
        <img class="modalclose" v-src="'../../image/3_guanbi.png'" v-myclick="[10, showmodal]">

        <div class="shengji-title">
          <div style="margin-right:10px;"><img v-src="'../../image/up_level.png'" width="40px"></div>
          <div style="margin-right:50px;">
            <img :src="getBg(up_content.level_id)" width="60px">
          </div>
        </div>
        <div class="shengji-desc">
          <div class="shengji_detail">自养牛数量上限：<span class="shengji_old">{{up_content.mp_max_cow_count=='-1'?'无上限':up_content.mp_max_cow_count}}&nbsp;→&nbsp;</span>{{up_content.max_cow_count=='-1'?'无上限':up_content.max_cow_count}}</div>
          <div class="shengji_detail">直接分享声望奖励：<span class="shengji_old">{{up_content.level_id==2?0:20}}&nbsp;→&nbsp;</span>20</div>
          <div class="shengji_detail">团队声望奖励：<span class="shengji_old">4&nbsp;→&nbsp;</span>4</div>
          <div class="shengji_detail">产奶加速奖励：<span class="shengji_old">{{up_content.mp_product_milk_rate}}&nbsp;→&nbsp;</span>{{up_content.product_milk_rate}}</div>
          <div class="shengji_detail">一次性奖励：<span style="color:#FF504D">{{up_content.bonus_voucher}}积分商城券</span></div>
        </div>
        <div class="modalbutton" v-myclick="show_shengji">
          <img v-src="'../../image/anniu_3.png'" >
          <span>太棒了</span>
        </div>
      </div>
    </div>
    <div class="pasture-nav">
      <img v-src="'../../image/3_2js.png'" v-myclick="[0, showmodal]">
      <img v-src="'../../image/3_1ck.png'" v-myclick="[1, showmodal]" style="position:relative">
      <!-- <span style="position:absolute;top:75px;right:0px;color:#172E71;width:80px;font-size:12px" v-myclick="[1, showmodal]">{{user.product_milk}}</span> -->
      <img v-src="'../../image/3_4jt.png'" v-myclick="[2, showmodal]">
      <img v-src="'../../image/3_3jy.png'" v-myclick="[1, opendshop]">
    </div>
    <div class="pasture-more" >
      <div class="more-right" v-myclick="more">
        <img src="../../image/zhankai.png" v-show="showmore">
        <img src="../../image/suojin.png" v-show="!showmore">
      </div>
      <div class="more-left" v-show="showmore">
        <img src="../../image/linchang.png" v-myclick="new_activity">
        <img src="../../image/nongchang.png" v-myclick="new_activity">
        <img src="../../image/yuchang.png" style="padding-bottom:5px" v-myclick="new_activity">
      </div>
    </div>
    <div class="pasture-activity">
      <div class="activity-left" v-show="showactivity">
        <img src="../../image/meiriqiandao.png" v-myclick="[3, showmodal]">
        <img src="../../image/huangjinmumin.png" v-myclick="[6, showmodal]">
        <img src="../../image/dahengzhilu.png" v-myclick="[5, showmodal]">
        <img src="../../image/33jihua.png" v-myclick="[4, showmodal]" style="padding-bottom:5px">
      </div>
      <div class="activity-right" v-myclick="activity" >
        <img src="../../image/huodong.png">
      </div>
    </div>
  </div>

</div>
</body>
<script src="../../script/api.js"></script>
<script src="../../script/vue.js"></script>
<script src="../../script/app.js"></script>
<script src="../../script/common.js"></script>
<script src="../../script/url.js"></script>
<script src="../../script/aui-sharebox.js" ></script>
<script src="../../script/aui_api.js"></script>

<script src="../../script/aui-tab.js" ></script>
<script>

    var user,
        qrcode,
        scanner,
        wx,
        qq,
        clipBoard,
        wap_url,
        planinfo,
        vm;

    var mq;
    apiready = function () {
        setBSImg();
        scanner = api.require('FNScanner');
        wx = api.require('wx');
        wxPay = api.require('wxPay');
        qq = api.require('QQPlus');
        MNActionButton = api.require('MNActionButton');
        clipBoard = api.require('clipBoard');
        wap_url = wap;
        mq = api.require('meiQia');
        showProgress();
        var data = {
            member_id: getPrefs('member_id')
        };
        var callback = function (ret) {
            user = ret.content;
            initApp();
        };
        pinet.post(URL.getUserinfo, data, callback);
        addListeners();
        api.parseTapmode();
    };
    function openSharebox(){
      var sharebox = new auiSharebox();
      sharebox.init({
        frameBounces:true,//当前页面是否弹动，（主要针对安卓端）
        buttons:[
          {
            image:'../../image/iconfont-weixin.png',
            text:'微信',
            value:'wx'//可选
        }
      ],
        col:5,
        cancelTitle:'取消'//可选,当然也可以采用下面的方式使用图标
        // cancelTitle:'<i class="aui-iconfont aui-icon-close aui-font-size-16"></i>'//可选
    },function(ret){
        if(ret){
          buttonValue = ret.buttonValue;
          switch (buttonValue) {
            case 'wx':
            vm.share_wx('session');
            case 'wx-circle':
            vm.share_wx('timeline');
            case 'qq':
            vm.share_qq();
              break;
            default:

          }
        }
    })
}

    function initApp() {
        vm = new Vue({
            el: '#app',
            data: {
                user: user,
                modal:false,
                showtype:1,
                count:1,
                showactivity:false,
                showmore:false,
                signinfo:'',
                signarr:[],
                planinfo:{
                  state:0,
                  is_bonus:0,
                  date_add:new Date().getTime()
                },
                imgPath: '../../image/',
                total_coins:60,
                is_sign:false,
                first_gift:user.first_gift,
                show_buy:false,
                appInstalled: {
                    wx: true,
                    qq: true,
                },
                BSImg: {
                    big: Vue.BSImg == 'big',
                    small: Vue.BSImg == 'small',
                },
                invite_list:[],
                type2_list:[],
                type3_list:[],
                GoldLevel2Count:0,
                growUp_result:[],
                wap_url:wap_url,
                level_up_arr:{},
                expected_product_milk:0,
                up_index:0,
                up_content:{},
                next_level_name:'',
                next_level_cow:0,
                renown_cow:0,
                keep_level_cow:0,
                is_selected:true,
                gold_mumin:host+'public/images/huangjinmumin_1.png',
                gold_muzhang:host+'public/images/huangjinmuzhang_1.png',


            },
            mounted:function(){
              this.getLevelRecord();
              // this.qiandaoinfo();
              this.plan();
              this.getGoldLevelRecord();
              this.getGoldLevel2Count();
              this.expected_product();
              this.next_level();

              TimeDown('time_circle');
              TimeDown('time_product');
              if(this.first_gift==0){
                this.showmodal(8);
              }

            },
            methods: {
              showmodal:function (id) {
                this.showtype = id;
                if(this.showactivity){
                  this.showactivity = false;
                }else{
                  api.sendEvent({
                    name: 'showModal',
                });
                  this.modal = !this.modal;
                  this.get_number();
                  this.next_level();
                }
                if(this.show_buy){
                  this.show_buy =!this.show_buy;
                }
                if(!this.showmore){
                  $api.css($api.dom('.pasture-activity'), 'z-index:0 ');
                }
                if(id==4){
                  this.plan();
                }
                if(id==5||id==6){
                  this.getGoldLevelRecord();
                }

              },
              get_number:function(){
                var buy_number = 1;
                if(parseInt(this.next_level_cow)>0){
                  buy_number =  parseInt(this.next_level_cow);
                }else if(parseInt(this.renown_cow)>=1){
                  buy_number =  parseInt(this.renown_cow);
                }else if(parseInt(this.keep_level_cow)>0){
                  buy_number = parseInt(this.keep_level_cow);
                }
                this.count = buy_number;
              },
              next_level:function(){
                var level_id = parseInt(this.user.level_id);
                var rate = getMemberStyle(level_id).product_rate;
                var expected_product_milk = (parseInt(this.user.cow)*rate).toFixed(2);
                var next_level_info = getMemberStyle(level_id+1);
                var cur_level_info = getMemberStyle(level_id);
                this.next_level_name = next_level_info.level_name;
                this.next_level_cow = next_level_info.cow - this.user.cow - this.user.calf;
                this.renown_cow = this.user.renown/1900 - this.user.product_milk/19 - expected_product_milk/19;
                this.keep_level_cow = cur_level_info.cow- this.user.cow - this.user.calf;
                this.get_number();
              },
              buycoins:function () {
                openWin("../game/buycoins");
              },
              opencoins:function(){
                openWin("../game/mycoins");
              },
              prestige:function () {
                openWin("../game/prestige");
              },
              getBg: function (level_id) {
                var memberStyle = getMemberStyle(level_id);
                return ("../../image/"+Vue.BSImg + '/' +memberStyle.level_up_bg);
            },
            change_selected:function(){
              this.is_selected = !this.is_selected;
            },
              getLevelRecord:function(){
                var data = {
                    member_id: getPrefs('member_id')
                };
                var callback = function (ret) {
                  vm.level_up_arr = ret.content;
                  vm.show_shengji();
                  // if(ret.content)
                };
                pinet.post(URL.getLevelRecord, data, callback);
              },
              show_shengji:function(){
                var shengji_wake = getPrefs('shengji_wake');
                var today_time = new Date(new Date().setHours(0, 0, 0, 0)) / 1000;

                sign_wake = Date.parse(new Date())/1000;
                if(shengji_wake>today_time){
                  this.qiandaoinfo();

                }else{
                  if(this.level_up_arr[this.up_index]){
                    if(this.up_index>0){
                      this.showmodal(10);
                    }
                    this.up_content = this.level_up_arr[this.up_index];
                    this.up_index++;
                    // setTimeout(function(){; }, 1000);
                    var t;
                      clearTimeout(t)
                      t = setTimeout(function (){
                          vm.showmodal(10)
                      }, 1000);
                    // setTimeout(this.showmodal(10),5000)
                  }else if (this.up_index>0) {
                    this.showmodal(10);
                    this.qiandaoinfo();
                    setPrefs('shengji_wake',sign_wake);

                  }else{
                    this.qiandaoinfo();
                    setPrefs('shengji_wake',sign_wake);

                  }

                }

              },
              new_activity:function () {
                api.toast({
                    msg: '敬请期待',
                    duration: 2000,
                    location: 'middle'
                });

              },
              expected_product:function () {
                var level_id = this.user.level_id;
                var rate = getMemberStyle(level_id).product_rate;

                var expected_product_milk = (parseInt(this.user.cow)*rate).toFixed(2);
                this.expected_product_milk = expected_product_milk;

              },
              expected_product_reload:function(){
                var level_id = vm.user.level_id;
                var rate = getMemberStyle(level_id).product_rate;

                var expected_product_milk = (parseInt(vm.user.cow)*rate).toFixed(2);
                vm.expected_product_milk = expected_product_milk;

              },
              reload:function(){
                var data = {
                    member_id: getPrefs('member_id')
                };
                var callback = function (ret) {
                    vm.user = ret.content;
                    setPrefs('username', user.nickname);
                    setPrefs('portrait', user.portrait);
                    setPrefs('level_id', user.level_id);
                    vm.expected_product_reload();

                };
                pinet.post(URL.getUserinfo, data, callback);
              },
              getpre: function (count,total) {
                return {
                    width:(count<=total?count/total*100+"%":'100%')
                };
            },
              joinPlan:function(){
                var data = {
                    member_id: getPrefs('member_id')
                };
                var callback = function (ret) {
                  api.toast({
                    msg : '参与成功',
                    duration : 3000,
                    location : 'middle'
                  });

                  vm.planinfo = ret.content;
                };
                pinet.post(URL.joinPlan, data, callback);
              },
              getThreePlanBonus:function(){
                var data = {
                    member_id: getPrefs('member_id'),
                    plan_id: vm.planinfo.plan_id
                };
                var callback = function (ret) {
                  api.toast({
                    msg : '领取成功',
                    duration : 3000,
                    location : 'middle'
                  });

                  vm.plan();
                  vm.reload();
                };
                pinet.post(URL.getThreePlanBonus, data, callback);
              },

        			getDate:function(timestamp,n){

        				var ss = 24 * 60 * 60 * 1000; //一天的毫秒数86400
        				// var timestamp = new Date().getTime(); //获取当前时间戳
        				var date1 = new Date(ss * n + timestamp) //加上n天的国际标准日期
        				var newTime = date1.toLocaleString(); //把日期转换成2018/6/4 下午10:45:19 格式
        				var arr = newTime.split(" "); //把2018/6/4提取出来
        				var arr2 = arr[0].split('/'); //把年月日数字单独提出来
        				return arr2[0] + '年' + arr2[1] + '月' + arr2[2] + '日'; //拼接成我们需要的格式返回

        			},
              qiandaoinfo:function(){
                var data = {
                    member_id: getPrefs('member_id')
                };
                var callback = function (ret) {
                    vm.signinfo = ret.content;
                    // console.log(JSON.stringify(ret.content))
                    if(ret.content.mark!=''){
                      vm.signarr = vm.signinfo.mark.split(",").map(parseFloat);
                    }
                    //获取今日是否提示签到
                    var sign_wake = getPrefs('sign_wake'+getPrefs('member_id'));
                    if(!sign_wake&&ret.content.is_sign==0&&vm.first_gift!=0){
                      vm.showmodal(3);
                      sign_wake = Date.parse(new Date())/1000;
                      setPrefs('sign_wake',sign_wake);
                    }
                    var today_time = new Date(new Date().setHours(0, 0, 0, 0)) / 1000;
                    if(sign_wake<today_time&&ret.content.is_sign==0&&vm.first_gift!=0){
                      vm.showmodal(3);
                      sign_wake = Date.parse(new Date())/1000;

                      setPrefs('sign_wake'+getPrefs('member_id'),sign_wake);

                    }
                };
                pinet.post(URL.getSignInfo, data, callback);
              },
              getGoldLevel2Count:function(){
                var data = {
                    member_id: getPrefs('member_id'),
                };
                var callback = function (ret) {
                  vm.GoldLevel2Count = ret.content;
                };
                pinet.post(URL.getGoldLevel2Count, data, callback);
              },
              getGoldLevelRecord:function(){
                var data = {
                    member_id: getPrefs('member_id'),
                };
                var callback = function (ret) {
                  var invite_list = ret.content;
                  // console.log(JSON.stringify(invite_list));
                  var type2_list = invite_list.gold_l2_list;
                  var type3_list = invite_list.gold_l3_list;
                  for (var i = 0; i < 5; i++) {
                    vm.type2_list[i] = type2_list[i]?type2_list[i].portrait:'../../image/default_member.png';

                  }
                  for (var j = 0; j < 3; j++) {
                    vm.type3_list[j] = type3_list[j]?type3_list[j].portrait:'../../image/default_member.png'
                  }
                  vm.invite_list = ret.content;
                };
                pinet.post(URL.getGoldLevelRecord, data, callback);
              },
              buyProp:function(){
                if(this.is_selected){
                  if(this.total_coins>this.user.gold){
                    var data = {
                        foreign_infos:this.count+';'+this.count*6,
                        order_type: 2,
                        member_id: getPrefs('member_id'),
                        order_amount: (this.count*6 - this.user.gold/10).toFixed(2),
                        pay_type: 1,
                        use_gold:1,
                        gold_number:this.user.gold,
                        cow_number:this.count,
                    };
                    pinet.post(URL.buycow, data, vm.pay_common);
                  }else{
                    var data = {
                        member_id: getPrefs('member_id'),
                        prop_id:3,
                        num:this.count
                    };
                    if(this.count <= 0 || this.count > 1000){
                      alert("输入数量错误，购买范围为1到1000")
                      this.count = 0
                      return
                    }
                    this.count = Math.round(this.count)
                    var callback = function (ret) {
                      api.toast({
                        msg : '购买成功',
                        duration : 3000,
                        location : 'middle'
                      });
                      vm.reload();
                      vm.modal = !vm.modal;
                      api.sendEvent({
                        name: 'showModal',
                    });
                    };
                    pinet.post(URL.buyProp, data, callback)

                  }
                }else{
                  var data = {
                      foreign_infos:this.count+';'+this.count*6,
                      order_type: 2,
                      member_id: getPrefs('member_id'),
                      order_amount: this.count*6,
                      pay_type: 1,
                      use_gold:0,
                      gold_number:0,
                      cow_number:this.count,
                  };
                  pinet.post(URL.buycow, data, vm.pay_common);
                }

              },
              pay_common:function(ret){
                this.pay_wx(ret.content);
              },
              pay_wx: function (infos) {
                wxPay.payOrder({
                    apiKey: infos.apiKey,
                    orderId: infos.prepayid,
                    mchId: infos.partnerid,
                    nonceStr: infos.noncestr,
                    timeStamp: infos.timestamp,
                    package: infos.package,
                    sign: infos.sign
                }, function (ret, err) {
                    if (ret && ret.status) {
                        api.toast({
                            msg: '支付成功',
                            duration: 2000,
                            location: 'middle'
                        });
                        vm.reload();

                    } else if (err.code == -2) {

                    } else {
                        alert('支付失败,错误码:' + err.code);
                    }
                });
            },
              plan:function(){
                var data = {
                    member_id: getPrefs('member_id')
                };
                var callback = function (ret) {
                  if(ret.content!= null){
                    vm.planinfo = ret.content
                  }
                };
                pinet.post(URL.getThreePlanInfo, data, callback)
              },
              opendshop:function(type){
                if(type==2){
                  var url = yimahost+"sale.html?member_id="+getPrefs('member_id')+"&token="+getPrefs('token');
                }else{
                  var url = yimahost+"buy.html?member_id="+getPrefs('member_id')+"&token="+getPrefs('token');

                }
                openWin("../game/yima",{url: url});
              },
              qiandao:function () {
                var days_sign = vm.signarr.length>0?parseInt(vm.signarr.slice(-1))+parseInt(1):1;
                var data = {
                    member_id: getPrefs('member_id'),
                    days:days_sign>7?1:days_sign
                };
                var callback = function (ret) {
                  api.toast({
                    msg : '签到成功',
                    duration : 3000,
                    location : 'middle'
                  });
                  vm.qiandaoinfo();
                  vm.reload();

                  vm.signinfo.is_sign= 1;
                };
                pinet.post(URL.sign, data, callback);
              },
              sacrifice:function(){
                var data = {
                    member_id: getPrefs('member_id')
                };
                var callback = function (ret) {
                  api.toast({
                    msg : '献祭成功',
                    duration : 3000,
                    location : 'middle'
                  });
                  vm.reload();
                };
                pinet.post(URL.sacrifice, data, callback);
              },
              share_wx: function (scene) {
                 var that = this;
                  if(!that.appInstalled.wx){
                    api.alert({
                        title: '提示',
                        msg: '未能检测到本地微信',
                        buttons: ['确定']
                    }, function (ret, err) {});
                  }else{
                    share_wx(scene, vm.user.share);
                  }
              },
              shengji:function(){
                var data = {
                    member_id: getPrefs('member_id')
                };
                var callback = function (ret) {
                  vm.growUp_result = ret.content;

                  api.toast({
                    msg : '升级成功',
                    duration : 3000,
                    location : 'middle'
                  });
                  vm.showtype = 7;
                  vm.modal = !vm.modal;
                  api.sendEvent({
                    name: 'showModal',
                });
                  vm.reload();
                };
                pinet.post(URL.growUp, data, callback);
              },
              more:function(){
                var z_index = this.showmore?0:66;
                $api.css($api.dom('.pasture-more'), 'z-index: '+z_index);
                this.showtype = -1;
                this.showmore=!this.showmore;
                this.modal =  !this.modal;
                api.sendEvent({
                  name: 'showModal',
              });
              },
              activity:function(){
                var z_index = this.showactivity?0:66;
                $api.css($api.dom('.pasture-activity'), 'z-index: '+z_index);
                this.showtype = -1;
                this.showactivity=!this.showactivity;
                this.modal =  !this.modal;
                api.sendEvent({
                  name: 'showModal',
              });
              },
              changecount:function (type) {
                if(type==1){
                  this.count= parseInt(this.count)+1;
                }
                if(type==0&&this.count>1){
                  this.count=parseInt(this.count)-1;
                }
                // this.total_coins = this.count*100;
              },
              help: function () {
                  var url = this.wap_url + 'home/helpword';
                  openWin('../home/browser', {url: url});
              },
              get_gift:function(){
                var data = {
                    member_id: getPrefs('member_id')
                };
                var callback = function (ret) {
                  api.toast({
                    msg : '领取成功',
                    duration : 3000,
                    location : 'middle'
                  });
                //   vm.showtype = 8;
                //   vm.modal = !vm.modal;
                //   api.sendEvent({
                //     name: 'showModal',
                // });
                  vm.showmodal(8);
                  vm.first_gift=1;
                  vm.reload();
                  vm.qiandaoinfo();
                };
                pinet.post(URL.firstGiftByOnce, data, callback);
              }
            },
            created: function () {
                var that = this;
                wx.isInstalled(function (ret) {
                    that.appInstalled.wx = ret.installed;
                });
                // qq.installed(function (ret) {
                //     that.appInstalled.qq = ret.status;
                // });
            },
            watch:{
              count: function (newVaL) {
                this.total_coins = this.count*60;
                if(this.total_coins<this.user.gold){
                  this.show_buy = false;
                }
              },
            },
        })
    }

    function nFormatter(num, digits) {
               var si = [
                   { value: 1, symbol: "" },
                  //  { value: 1E3, symbol: "K" },
                   { value: 1E4, symbol: "万" },

                  //  { value: 1E6, symbol: "M" },
                  //  { value: 1E9, symbol: "G" },
                  //  { value: 1E12, symbol: "T" },
                  //  { value: 1E15, symbol: "P" },
                  //  { value: 1E18, symbol: "E" }
               ];
               var rx = /\.0+$|(\.[0-9]*[1-9])0+$/;
               var i;
               for (i = si.length - 1; i > 0; i--) {
                   if (num >= si[i].value) {
                       break;
                   }
               }
               return (num / si[i].value).toFixed(digits).replace(rx, "$1") + si[i].symbol;
           }

   function TimeDown(id) {
    //结束时间
    // var endDate = new Date(endDateStr);
    var endDate = new Date(new Date().setHours(0, 0, 0, 0)) / 1000+24*60*60;
    //当前时间
    var nowDate = (new Date())/1000;
    //相差的总秒数
    var totalSeconds = parseInt(endDate - nowDate);
    //天数
    var days = Math.floor(totalSeconds / (60 * 60 * 24));
    //取模（余数）
    var modulo = totalSeconds % (60 * 60 * 24);
    //小时数
    var hours = Math.floor(modulo / (60 * 60));
    modulo = modulo % (60 * 60);
    //分钟
    var minutes = Math.floor(modulo / 60);
    //秒
    var seconds = modulo % 60;
    //输出到页面
    document.getElementById(id).innerHTML =  hours + ":" + minutes + ":" + seconds;
    // var time_str = hours+':'+minutes+':'+seconds;
    // vm.time_str = time_str;
    //延迟一秒执行自己
    setTimeout(function () {
        TimeDown(id);
    }, 1000)
}



    function addListeners() {
      api.addEventListener({
          name: 'switch_to_frame_2'
      }, function (ret, err) {
        vm.reload();
        vm.plan();
      });

        api.addEventListener({
            name: 'viewappear'
        }, function (ret, err) {
        });
        api.addEventListener({
            name: 'updateproperty'
        }, function (ret, err) {
          console.log('updateproperty');
          vm.reload();
        });
    }


</script>
</html>
